<template>
  <view class="richText">

    <uParse :content="comContent"></uParse>

    <view style="padding: 50rpx 0 80rpx 0">
      <u-loadmore :load-text="loadText" status="nomore" />
    </view>
  </view>
</template>

<script>
import uParse from "@/components/feng-parse/parse.vue";
import config from "@/config";
const baseUrl = config.imgbaseUrl;
export default {
  components: { uParse },
  name: "rich-text",
  props: {
    content: {
      type: String,
      default:
        '<img src="https://xj.my.dumicdn.cn/stage-api/profile/upload/2023/03/28/show_435510579_1679892843679_20230328140410A081.jpg" />',
    },
    title: {
      type: String,
      default:
        "",
    },
    report: {
      type: String,
      default: "小枧之声 小枧之声 2020-12-21 22:14 发表于四川",
    },
  },
  computed: {
    comContent: function () {
      // debugger;
      // console.log(baseUrl);
      let aa = this.content
      // let aa = this.content.replace(
      //   /<img [^>]*src=['"]([^'"]+)[^>]*>/gi,
      //   function (match, capture) {
      //     console.log(baseUrl);
      //     return '<img  src="' + (baseUrl + capture) + '"/>';
      //   }
      // );
      // console.log(aa);
      return aa;
    },
    //  processedContent(content) {
    //   debugger
    //   console.log(baseUrl);
    //        let aa = content.replace(
    //          /< img [^>]*src=['"]([^'"]+)[^>]*>/gi,
    //          function (match, capture) {
    //            return '< img  src="' + (baseUrl + capture) + '"/>'
    //          }
    //        )
    //        return aa
    //      },
  },
  data() {
    return {
      loadText: {
        loadmore: "END",
        loading: "END",
        nomore: "END",
      },
    };
  },
  // methods:{
  //  processedContent(content) {
  //   debugger
  //   console.log(baseUrl);
  //        let aa = content.replace(
  //          /< img [^>]*src=['"]([^'"]+)[^>]*>/gi,
  //          function (match, capture) {
  //            return '< img  src="' + (baseUrl + capture) + '"/>'
  //          }
  //        )
  //        return aa
  //      },
  // }
};
</script>

<style lang="scss">
.richText {
  width: 100%;

  .title {
    text-align: center;
    font-size: 40rpx;
    font-family: PingFang SC;
    font-weight: bold;
    color: #282828;
  }

  .time {
    padding: 28rpx 0 36rpx 0;
    font-size: 22rpx;
    font-family: PingFang SC;
    font-weight: 400;
    color: #666666;
    text-align: center;
  }
}
</style>
